obj-m := try_to_del_timer_sync.o

PWD := $(shell pwd)

ARCH = arm

CROSS_COMPILE = arm-linux-gnueabi-

KDIR = /home/ubuntu/runningLinux/runninglinuxkernel_4.0

OUTPUT = ${KDIR}/kmodules

ifeq ($(ARCH),)
ARCH := $(shell uname -m)
endif
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE :=
endif
ifeq ($(KDIR),)
KDIR := /lib/modules/$(shell uname -r)/build
ifeq ($(ARCH),i686)
ifeq ($(wildcard $KDIR/arch/$ARCH),)
ARCH=i386
endif
endif
endif

default:
	ln -sf makefile Makefile
	$(MAKE) ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -C $(KDIR) M=$(PWD) modules
	cp  *.ko  ${OUTPUT}/

clean:
	rm -rf Makefile
	rm -rf *.o *~ core .depend .*.cmd  *.mod.c .tmp_versions Module.* modules.order
